package com.reflex;

import java.lang.reflect.AnnotatedType;
import java.lang.reflect.Method;
import java.util.Arrays;

public class ReflexDemo06 {
    public static void main(String[] args) throws Exception {
        // 获取Class对象
        Class<?> aClass = Class.forName("com.reflex.Person");
        // 获取所有方法
        Method method = aClass.getMethod("say", String.class, int.class);
        String name = method.getName();
        System.out.println("方法名 = " + name);

        Class<?> returnType = method.getReturnType();
        System.out.println("方法的返回类型 = " + returnType);

        Class<?>[] parameterTypes = method.getParameterTypes();
        System.out.println("方法的参数类型 = " + Arrays.toString(parameterTypes));


    }
}
